<?php
require 'yakexi/Yakexi.php';
use yakexi as ykx, yakexi\Yakexi, yakexi\Template;

class DocPage extends ykx\RequestHandler
{
	public function get($topic=null)
	{
		if (is_null($topic))
			$topic = 'index';
		if (!in_array($topic, array('index', 'running')))
		{
			$this->response->set_status(404);
			die('Not Found');
		}
		$template_values = array(
			'topic' => $topic
			);
		$path = BASEPATH . 'templates/' . "{$topic}.php";
		$this->response->write(Template::render($path, $template_values));
	}
}

$application = new Yakexi(array('/' => DocPage, 
                                '/(.*)\.html' => DocPage), True);
$application->run_sae_app();
